package cn.kgc.mushroommanager.controller;

import cn.kgc.mushroomcommon.api.DataBaseOperationRemoteService;
import cn.kgc.mushroomcommon.pojo.Coll;
import cn.kgc.mushroomcommon.pojo.Shop;
import cn.kgc.mushroomcommon.vo.ShopVO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 项目名：mushroom
 * 创建人：Junyizm
 * 创建时间：2020/4/27-22:21
 */
@RestController
@RequestMapping("/shop/manager")
public class ShopController {
    @Resource
    DataBaseOperationRemoteService dataBaseOperationRemoteService;

//    @RequestMapping("/shop/title/type")
//    public List<Shop> shopTitleType(@RequestParam("titleOrTypeName") String titleOrTypeName){
//        return dataBaseOperationRemoteService.selectShopByTitleOrTypeName(titleOrTypeName);
//    }

    @RequestMapping("/selectAll")
    public List<Shop> selectAll(){
        List<Shop> selectall = dataBaseOperationRemoteService.selectall();
        return selectall;
    }


    @RequestMapping("/selectByid")
    public Shop selectById(@RequestParam("id")Integer id) {
        Shop shop = dataBaseOperationRemoteService.selectById(id);
        return shop;
    }
    @RequestMapping("/selectShopComId")
    public Shop selectShopComId(@RequestParam("id")Integer id){
        Shop shops = dataBaseOperationRemoteService.selectShopComId(id);
        return  shops;

    }

    @RequestMapping("/insertshopanduser")
    public Map<String,Object> insertshopanduser(@RequestParam("shopcollid")Integer shopcollid, @RequestParam("userid")Integer userid){
         Map<String, Object> insertshopanduser = dataBaseOperationRemoteService.insertshopanduser(shopcollid, userid);
         return insertshopanduser;
    }

    @RequestMapping("/selectColl")
    public List<Coll> selectColl(@RequestParam("userid")Integer userid){
        List<Coll> Coll = dataBaseOperationRemoteService.selectColl(userid);
        return  Coll;
    }

    @RequestMapping("/selectshopbyname")
    public List<ShopVO> selectShopByName(@RequestParam("shopName")String shopName){
        List<ShopVO> shopVOS = dataBaseOperationRemoteService.selectshopByName(shopName);
        return shopVOS;
    }
}
